import Vue from "vue";
import Router from "vue-router";
import Login from "@/components/login";
import Market from "@/components/market";
import Home from "@/components/home";
import Nav from "@/components/nav";
import Mine from "@/components/mine";
import Auction from "@/components/auction";
import Monkey from "@/components/monkey";
import Items from "@/components/items";
import Find from "@/components/find";
import Details from "@/components/details";
import PlaceOrderEntity from "@/components/placeOrderEntity";
import Cart from "@/components/cart";
import Ranking from "@/components/ranking";
import Toselect from "@/components/toselect";
import Order from "@/components/order";
import Terms from "@/components/terms";
import Invitation from "@/components/invitation";
Vue.use(Router);

export default new Router({
  mode: "history",
  saveScrollPosition: true,
  routes: [
    {
      path: "/",
      redirect: "/home"
    },
   
    {
      path: "/login",
      component: Login
    },
    
    {
      path:"/home",
      component: Nav,
      children: [
        {
          path: "/home",
          component: Home,
          meta: {
            requireAuth: true
          }
        },
        {
          path: "/market",
          component: Market,
          meta: {
            requireAuth: true,
            keepAlive: true
          }
        },
        {
          path: "/find",
          component: Find,
          meta: {
            requireAuth: true
          }
        },
        {
          path: "/cart",
          component: Cart,
          meta: {
            requireAuth: false
          }
        },
        {
          path: "/mine",
          component: Mine,
          meta: {
            requireAuth: true
          }
        }
      ]
    },  
    {
      path: "*",
      redirect: "/404"
    },
    {
      path: "/auction/:id",
      component: Auction
    },
    
    {
      path: "/monkey/:id",
      component: Monkey
    },
    {
      path: "/cart",
      component: Cart
    },
    {
      path: "/toselect/:id",
      component: Toselect
    },
    {
      path: "/ranking",
      component: Ranking
    },
    {
      path: "/order",
      component: Order
    },
    {
      path: "/terms",
      component: Terms
    },
    {
      path: "/placeOrderEntity",
      component: PlaceOrderEntity
    },
    {
      path: "/invitation",
      component: Invitation
    },
    {
      path: "/details",
      component: Details
    }
  ]
});
